<%-- 
    Document   : roleAddEdit
    Created on : 25/02/2013
    Author     : Volodymyr Lavrynovych <volodya.lavrynovych@gmail.com>
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Add/Edit Role</title>
        <script type="text/javascript">
            var isEdit = ${isEdit};
            $(document).ready(function(){
                uic.simpleform({
                    id: 'simpleform',
                    showTitle: false,
                    target: $('div.add_edit')
                }).add(uic.control.input({
                    id: 'name',
                    type: 'text',
                    placeholder: 'Name',   
                    value: '${obj.name}',
                    title: 'Name',
                    rules: {
                        required: true,
                        messages: {
                            required: "Please enter a name"
                        }
                    }
                })).add(uic.control.checkbox({
                    id: 'active',
                    checked: '${obj.active}',
                    title: 'Is Active'
                })).addButton(uic.element.button({
                    onclick: function(){
                        model.submit({
                            id: '${obj.id}',
                            name: $('#name').val(),
                            active: $('#active').is(':checked')
                        }, isEdit);
                    },
                    id: 'submit',
                    title: 'Ok',
                    primary: true
                })).addButton(dialogManager.getCloseButton()).initValidation();
            });
        </script>
    </head>
    <body>
        <div class="add_edit"></div>
    </body>
</html>